import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import _inherits from "@babel/runtime/helpers/esm/inherits";
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
import _isString from "lodash/isString";
import _isBoolean from "lodash/isBoolean";

/**
 * Input.js
 * @date 2018/11/14
 */
import React from 'react';
import { Form, Checkbox } from 'antd';
import ValueList from 'components/ValueList/index'; // import intl from 'utils/intl';

import pageStyles from "../../index.less?modules";
import { attributeNameProp, attributeTypeProp, attributeValueProp } from "../../config";
import DataType from "../../DataType";
var typeCaseOptions = [{
  value: '',
  meaning: '不转换'
}, {
  value: 'upper',
  meaning: '大写'
}, {
  value: 'lower',
  meaning: '小写'
}];

var FieldInput = /*#__PURE__*/function (_React$Component) {
  _inherits(FieldInput, _React$Component);

  var _super = _createSuper(FieldInput);

  function FieldInput() {
    _classCallCheck(this, FieldInput);

    return _super.apply(this, arguments);
  }

  _createClass(FieldInput, [{
    key: "render",
    value: function render() {
      var _this$props = this.props,
          form = _this$props.form,
          _this$props$propValue = _this$props.propValues,
          propValues = _this$props$propValue === void 0 ? {} : _this$props$propValue;
      return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Form.Item, null, form.getFieldDecorator('inputChinese', {
        initialValue: _isBoolean(propValues.inputChinese) ? propValues.inputChinese : true
      })( /*#__PURE__*/React.createElement(Checkbox, {
        checkedValue: false,
        unCheckedValue: true
      }, "\u4E0D\u5141\u8BB8\u8F93\u5165\u4E2D\u6587"))), /*#__PURE__*/React.createElement(Form.Item, null, form.getFieldDecorator('trimAll', {
        initialValue: _isBoolean(propValues.trimAll) ? propValues.trimAll : false
      })( /*#__PURE__*/React.createElement(Checkbox, {
        checkedValue: true,
        unCheckedValue: false
      }, "\u5220\u9664\u6240\u6709\u7A7A\u683C"))), /*#__PURE__*/React.createElement(Form.Item, {
        label: "\u5927\u5C0F\u5199\u8F6C\u6362"
      }, form.getFieldDecorator('typeCase', {
        initialValue: propValues.typeCase
      })( /*#__PURE__*/React.createElement(ValueList, {
        options: typeCaseOptions,
        className: pageStyles['full-width']
      }))));
    }
  }]);

  return FieldInput;
}(React.Component);

export { FieldInput as default };
export function getConfigOfPropValues(propValues) {
  var newConfig = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];

  if (_isBoolean(propValues.inputChinese)) {
    var _newConfig$push;

    newConfig.push((_newConfig$push = {}, _defineProperty(_newConfig$push, attributeNameProp, 'inputChinese'), _defineProperty(_newConfig$push, attributeValueProp, propValues.inputChinese), _defineProperty(_newConfig$push, attributeTypeProp, DataType.String), _newConfig$push));
  }

  if (_isString(propValues.typeCase)) {
    var _newConfig$push2;

    newConfig.push((_newConfig$push2 = {}, _defineProperty(_newConfig$push2, attributeNameProp, 'typeCase'), _defineProperty(_newConfig$push2, attributeValueProp, propValues.typeCase), _defineProperty(_newConfig$push2, attributeTypeProp, DataType.String), _newConfig$push2));
  }

  if (_isBoolean(propValues.trimAll)) {
    var _newConfig$push3;

    newConfig.push((_newConfig$push3 = {}, _defineProperty(_newConfig$push3, attributeNameProp, 'trimAll'), _defineProperty(_newConfig$push3, attributeValueProp, propValues.trimAll), _defineProperty(_newConfig$push3, attributeTypeProp, DataType.Boolean), _newConfig$push3));
  }

  return newConfig;
}
export var lifeUpgrade = [];
FieldInput.getConfigOfPropValues = getConfigOfPropValues;
FieldInput.lifeUpgrade = lifeUpgrade;